﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.DiagnosticSwitch
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine.Bindings;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine
{
  [RequiredByNativeCode]
  [NativeAsStruct]
  [NativeClass("DiagnosticSwitch", "struct DiagnosticSwitch;")]
  [NativeHeader("Runtime/Utilities/DiagnosticSwitch.h")]
  [StructLayout(LayoutKind.Sequential)]
  internal class DiagnosticSwitch
  {
    private IntPtr m_Ptr;

    private DiagnosticSwitch()
    {
    }

    public extern string name { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    public extern string description { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    [NativeName("OwningModuleName")]
    public extern string owningModule { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    public extern DiagnosticSwitch.Flags flags { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    public object value
    {
      get => this.GetScriptingValue();
      set => this.SetScriptingValue(value, false);
    }

    [NativeName("ScriptingDefaultValue")]
    public extern object defaultValue { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    [NativeName("ScriptingMinValue")]
    public extern object minValue { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    [NativeName("ScriptingMaxValue")]
    public extern object maxValue { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    public object persistentValue
    {
      get => this.GetScriptingPersistentValue();
      set => this.SetScriptingValue(value, true);
    }

    [NativeName("ScriptingEnumInfo")]
    public extern EnumInfo enumInfo { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern object GetScriptingValue();

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern object GetScriptingPersistentValue();

    [NativeThrows]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetScriptingValue(object value, bool setPersistent);

    public bool isSetToDefault => object.Equals(this.persistentValue, this.defaultValue);

    public bool needsRestart => !object.Equals(this.value, this.persistentValue);

    [System.Flags]
    internal enum Flags
    {
      None = 0,
      CanChangeAfterEngineStart = 1,
    }
  }
}
